package com.guchenbo.spring;

/**
 * @Author guchenbo
 * @Date 2020/6/12.
 */
public class Main {

    public void m(Person p1) {
        Person p2 = p1;
        System.out.println(p1 == p2);

        p2 = new Person("p2");
        System.out.println(p1 == p2);
        System.out.println(p1.getName());
        System.out.println(p2.getName());

        p2 = p1;
        System.out.println(p1 == p2);
        p2.setName("pp2");

        System.out.println(p1.getName());
        p2 = new Person("p3");
        System.out.println(p1==p2);
        System.out.println(p1.getName());
        System.out.println(p2.getName());
    }
    public static void main(String[] args) {
        Main main = new Main();
        Person p1 = new Person("p1");
        main.m(p1);
        System.out.println(p1.getName());

        System.out.println("====================");
        String s1 = "1";
        String s2 = new String("1");
        System.out.println(s1 == s2);
        System.out.println(s1 == s2.intern());

        String s3 = new String("12") + "3";
//        s3.intern();
        String s4 = "123";
        System.out.println(s3 == s4);
    }
}
